home *** CD-ROM | disk | FTP | other *** search
/ Ultra Mac Games 1 & 2 / UltraMacGames1.iso / Dungeon / Ancient b7.0 / spellsD / stack.txt < prev   
Text File  |  1994-03-26  |  12KB  |  416 lines

  1. -- stack: in
  2. -- format: 10 (HyperCard 2)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=480 h=304
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2714
  12. -- card count: 1
  13. -- first card id: 2957
  14. -- list block id: 2148
  15. -- print block id: 0
  16. -- font table block id: 3343
  17. -- style table block id: 3094
  18. -- free block count: 1
  19. -- free size: 672 bytes
  20. -- total size: 16384 bytes
  21. -- stack block size: 12800 bytes
  22. -- created by hypercard version: 0x02108001
  23. -- compacted by hypercard version: 0x02108001
  24. -- modified by hypercard version: 0x02108001
  25. -- opened by hypercard version: 0x02108001
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0xE1D8470F
  67. ----- HyperTalk script -----
  68. function heelhrm2 who,caster
  69. Global Names,otoHit,toEvade,hits,condition,ohits,omhits
  70. put needsHealing() into who
  71. if who=0 then -- attack
  72.   put getMagicUser() into who
  73.   put "get harm("&who*-1&","&caster&")" into castSpell
  74.   do castspell
  75. else -- heal
  76.   add random(8) to line who of ohits
  77.   if line who of ohits>line who of omhits then
  78.     put line who of omhits into line who of ohits
  79.   end if
  80.   get "heals a member of its party"
  81. end if
  82. return it
  83. end heelhrm2
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. --castASpell(who*-1,caster,dmg)
  96. function first who,caster,dmg -- Monster only
  97. Global Names,condition,toEvade
  98. Global otoHit,Hits,odmg,battleRnd,deadtypes
  99. if candothings(caster*-1) then -- active
  100.   repeat with p=1 to the number of lines in condition
  101.     if line p of condition is not in deadtypes then exit repeat
  102.   end repeat
  103.   put line P of Names into thisP
  104.   if playerisActive(p) then
  105.     if candothings(p) then put 1 into M else put 0 into M
  106.     multiply who by -1
  107.     if random(line who of otoHit+battlernd)>=random(M*line p of toEvade) then -- a hit!
  108.       put (line caster of odmg)*(m-2) into dmg
  109.       subtract random(dmg) from line p of hits
  110.       if line p of hits<=0 then -- dead
  111.         return "kill" && thisP
  112.       else
  113.         return "hits the" && thisP && "for" && dmg
  114.       end if
  115.     else
  116.       return "misses" && thisPs
  117.     end if
  118.   else
  119.     return "hits" && thisP && "who is" && line p of condition
  120.   end if
  121. else
  122.   return "is unable to attack"
  123. end if
  124. end first
  125.  
  126. function weakest who,caster,dmg
  127. Global Names,condition,toEvade,otoHit,Hits,odmg,battleRnd,deadtypes
  128. if candothings(caster*-1) then
  129.   put getWeakest() into p
  130.   put line P of Names into thisP
  131.   if playerisActive(p) then
  132.     if candothings(p) then put 1 into M else put 0 into M
  133.     if random(line caster of otoHit+battlernd)>=random(M*line p of toEvade) then -- a hit!
  134.       put (line caster of odmg)*(m-2)*-1 into dmg
  135.       put random(dmg) into dmg
  136.       subtract dmg from line p of hits
  137.       put line p of hits into line p of fld "hits"
  138.       if line p of hits<=0 then -- dead
  139.         put "dead" into line p of condition
  140.         return "kills"&&thisP
  141.       else
  142.         return "hits"&&thisP&&"for"&&dmg
  143.       end if
  144.     else
  145.       return "misses"&&thisP
  146.     end if
  147.   else
  148.     return "hits"&&thisP&&"who is"&&line p of condition
  149.   end if
  150. else
  151.   return "is unable to attack"&&thisP
  152. end if
  153. end weakest
  154.  
  155. function getWeakest
  156. Global condition,hits
  157. put empty into hitList
  158. repeat with p=1 to the number of lines in condition
  159.   if playerisActive(p) then
  160.     put line p of hits&"."&p&return after hitList
  161.   end if
  162. end repeat
  163. sort hitList numeric
  164. put line 1 of hitList into p
  165. put (p-trunc(p))*10 into p
  166. return p
  167. end getWeakest
  168.  
  169. function heelhrm1 who,caster,dmg
  170. Global Names,oNames,condition,ocondition,toEvade
  171. Global otoHit,oHits,omHits,Hits,oSpellPts
  172. put needsHealing() into W
  173. if playerisActive(caster*-1) then
  174.   if W=0 or line caster of oSpellPts<=0 then
  175.     put getActivePlayer() into P
  176.     if p<1 then put 1 into p
  177.     put line P of Names into thisP
  178.     if candothings(p) then put 1 into M else put 0 into M
  179.     if random(dmg*4)>random(M*line P of toEvade) then
  180.       put abs(M-2)*dmg into dmg -- double for cantdothings
  181.       subtract dmg from line P of Hits
  182.       if line P of Hits<=0 then -- dead
  183.         put "dead" into line P of condition
  184.         return "kills" && thisP
  185.       else
  186.         return "hits" && thisP && "for" && dmg
  187.       end if
  188.     else
  189.       return "misses" && thisP
  190.     end if
  191.   else -- heal the party member
  192.     add dice(2,6) to line W of ohits
  193.     if line W of oHits>line W of omHits then
  194.       put line W of omHits into line W of oHits
  195.     end if
  196.     if line W of oHits>line W of omhits+12 then debug checkpoint
  197.     subtract 1 from line caster of oSpellPts
  198.     return "heals a member of its party"
  199.   end if
  200. else
  201.   return "is" && line caster of ocondition
  202. end if
  203. end heelhrm1
  204.  
  205. --O or P,lineNumber,stat,dmg,delay,duration,text
  206. function asid who,caster
  207. GLOBAL oHits,oNames,hits,ohits,toHit,toEvade,otoHit,otoEvade,Names,battleRnd
  208. put Dice(2,2) into Dmg
  209. if candoThings(who) then put 1 into M else put 0 into M
  210. put dmg*abs(M-2) into dmg
  211. if who<0 then
  212.   multiply who by -1
  213.   put line who of Names into thisP
  214.   if random(line caster of otoHit+battleRnd)>random(M*line who of toEvade) then
  215.     subtract dmg from line who of Hits
  216.     get "P," & who & ",hits,-1,1,5,is burned by acid"
  217.     put the number of lines in cd fld "actionPerRound" into L
  218.     put it into line L+1 of cd fld "actionPerRound"
  219.     if playerisactive(who) then
  220.       get "'s acid burns" && thisP && "for" && Dmg
  221.     else
  222.       get "hits" && thisP &", who is" && line who of condition
  223.     end if
  224.   else
  225.     get "misses" && thisP
  226.   end if
  227. else
  228.   put "the" && line who of oNames into thisOne
  229.   put line caster of Names into thisP
  230.   if random(line caster of toHit+battleRnd)>random(M*line who of otoEvade) then
  231.     subtract Dmg from line who of oHits
  232.     get "O," & who & ",hits,-1,1,5,is burned by acid for 1"
  233.     put the number of lines in cd fld "actionPerRound" into L
  234.     put it into line L+1 of cd fld "actionPerRound"
  235.     if playerisactive(who*-1) then
  236.       get thisP & "'s acid burns" && thisOne && "for" && Dmg
  237.     else
  238.       get thisP && "throws acid at" && thisOne & ",who is" && line who of ocondition
  239.     end if
  240.   else
  241.     get thisP && "misses" && thisOne
  242.   end if
  243. end if
  244. return it
  245. end asid
  246.  
  247. function attParalyzed who,caster
  248. GLOBAL oCondition,oNames,Condition,Names,toHitMg,toEvade,otoHit
  249. Global oToEvade,battleRnd,hits,ohits,odmg
  250. put "The" && line caster of oNames into P
  251. put line caster of odmg into dmg
  252. if Condition contains "Paralyzed" then -- attack
  253.   put line 1 of getParalyzedP(Condition) into who
  254.   put line who of Names into T
  255.   if playerisActive(who) then
  256.     if candothings(who) then
  257.       put 1 into M
  258.       put random(dmg) into dmg
  259.     else
  260.       put 0 into M
  261.       put dmg*2 into dmg
  262.     end if
  263.     if random(line caster of otoHit+battleRnd)>M*random(line who of toEvade) then
  264.       subtract dmg from line who of hits
  265.       if line who of hits<=0 then
  266.         put "dead" into line who of condition
  267.         get "kills" && T
  268.       else
  269.         get "hits" && T && "for" && dmg
  270.       end if
  271.     else
  272.       get "misses" && T
  273.     end if
  274.   else
  275.     get "is unable to attack" && T
  276.   end if
  277.   return it
  278. else -- paralyze
  279.   -- spell form is: name(who*-1,caster,dmg)
  280.   put getActivePlayer() into P
  281.   put "get paralyze"&"("&P*-1&","&caster&")" into castSpell
  282.   do castSpell
  283. end if
  284. return it
  285. end attParalyzed
  286.  
  287. function getParalyzedP
  288. global Condition
  289. put empty into list
  290. repeat with p=1 to the number of lines in Condition
  291.   if line p of condition contains "Paralyzed"
  292.   then put p & return before list
  293. end repeat
  294. return list
  295. end getParalyzedP
  296.  
  297. function BlueWiz who,caster
  298. Global potions,Names,hits,oHits,omhits,condition,ocondition,ospellPts
  299. put line caster of oSpellPts into sp
  300. if line caster of oHits<=10 then -- heal flee
  301.   put "flee" into line caster of oCondition
  302.   get "flees to save itself"
  303. else if line caster of oHits<20 and sp>1 then -- heal self
  304.   add random(8)+4 to line caster of oHits
  305.   if line caster of ohits>line caster of omhits
  306.   then put line caster of omhits into line caster of ohits
  307.   subtract 1 from line caster of oSpellPts
  308.   get "heals itself"
  309. else -- attack
  310.   put getWeakest() into p
  311.   get grenade(p*-1,caster)
  312. end if
  313. return it
  314. end BlueWiz
  315.  
  316. function Witch3 who,caster
  317. Global ohits,omhits,oCondition,Class,condition,hits,mhits,Names
  318. put 0 into inNeed
  319. repeat with i=1 to the number of lines in ohits
  320.   if line i of ohits<=line i of omhits/2 then
  321.     if playerisActive(i*-1) then add 1 to inNeed
  322.   end if
  323. end repeat
  324. if inNeed>=2 and line caster of oSpellPts>0 then
  325.   get healparty(-1,caster)
  326. else if condition contains "paralyzed" then
  327.   put getParalyzed() into list
  328.   repeat with i=1 to the number of lines in list
  329.     put line i of list into p
  330.     if line p of Class="Mage" or line p of Class="Cleric" then
  331.       -- attack mage
  332.       put (random(4)+1)*2 into dmg
  333.       subtract dmg from line p of hits
  334.       if line p of hits<=0 then
  335.         get "killed"&&line p of Names
  336.         put "dead" into line p of condition
  337.       else
  338.         get "hits"&&line p of Names&&"for"&&dmg
  339.       end if
  340.     end if
  341.   end repeat
  342. else -- harmParty
  343.   get harmParty(-1,caster)
  344. end if
  345. return it
  346. end Witch3
  347.  
  348. function xDrain who,caster,p
  349. Global Names,hits,toEvade,spellPts,permanentSpells,condition
  350. Global oNames,otoHit,oSpells,odmg
  351. if p is not a number then -- choose who to attack
  352.   put getActivePlayer() into p
  353. end if
  354. put line p of Names into T
  355. if candoThings(p) then put 1 into M else put 0 into M
  356. if random(line caster of otoHit)>M*random(line p of toEvade) then -- hit
  357.   put line caster of odmg into xdmg
  358.   if M=0 then put xdmg*2 into dmg else put random(xdmg) into dmg
  359.   subtract dmg from line p of hits
  360.   get "hits"&&T&&"for"&&dmg
  361.   if line p of hits<=0 then -- dead
  362.     put "dead" into line p of condition
  363.     put "dead" into line p of fld "condition"
  364.     get "killed"&&T
  365.   else -- hit
  366.     if line p of spellPts>0 then
  367.       subtract dice(2,4) from line p of spellPts
  368.       if line p of spellPts<0 then put 0 into line p of spellPts
  369.       get "also drains"&&T&&"of spell pts."&return&it
  370.     end if
  371.   end if
  372. else -- miss
  373.   get "missed"&&T
  374. end if
  375. return it
  376. end xDrain
  377.  
  378. function xHome who,caster
  379. Global Names,condition,toEvade,otoHit
  380. multiply who by -1
  381. put line who of Names into P
  382. if candothings(who) then put 1 into M else put 0 into M
  383. if random(line caster of otoHit)>M*random(line who of toEvade) then
  384.   put "Home" into line who of condition
  385.   lock screen
  386.   push cd
  387.   go cd P
  388.   put "Andelair" into line 22 of fld "Stats"
  389.   pop cd
  390.   unlock screen
  391.   get "has sent"&&P&&"Home"
  392. else -- missed
  393.   get "tries to send"&&P&&"Home"
  394. end if
  395. return it
  396. end xHome
  397.  
  398. function Raise w,c
  399. global oNames,ohits,omhits,ocondition,oSpellPts
  400. put empty into list
  401. repeat with m=1 to the number of lines in oHits
  402.   if line m of oCondition="dead" then put m&return after list
  403. end repeat
  404. if list‚â†"" then -- raise
  405.   put random(the number of lines in list) into L
  406.   put line L of list into M
  407.   put "Good" into line M of oCondition
  408.   subtract 1 from line c of oSpellPts
  409.   put line M of omHits into line m of oHits
  410.   get "raises the"&&line m of oNames
  411. else
  412.   get weakest(w,c,14) -- attack weakest
  413. end if
  414. return it
  415. end Raise
  416.